package com.milhouz.quizzdroid.bean;

import android.os.Parcel;
import android.os.Parcelable;

public class Response implements Parcelable {

	private int mIndex;
	private String mResponse;
	private boolean mIsCorrectResponse;

	public Response() {
	}

	public Response(int index, String response) {
		this.mIndex = index;
		this.mResponse = response;
		if (index == 0) {
			mIsCorrectResponse = true;
		} else {
			mIsCorrectResponse = false;
		}
	}

	public int getIndex() {
		return mIndex;
	}

	public String getResponse() {
		return mResponse;
	}

	public boolean isCorrectResponse() {
		return mIsCorrectResponse;
	}

	@Override
	public void writeToParcel(Parcel parcel, int flag) {
		parcel.writeInt(mIndex);
		parcel.writeString(mResponse);
		parcel.writeString(String.valueOf(mIsCorrectResponse));
	}

	public static final Creator<Response> CREATOR = new Creator<Response>() {
		@Override
		public Response createFromParcel(Parcel source) {
			Response r = new Response();
			r.mIndex = source.readInt();
			r.mResponse = source.readString();
			r.mIsCorrectResponse = Boolean.valueOf(source.readString());
			return r;
		}

		@Override
		public Response[] newArray(int arg0) {
			return null;
		}
	};

	@Override
	public int describeContents() {
		return 0;
	}

}
